package com.njtoyo.taxi.admin.script;

import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import com.njtoyo.taxi.admin.mapper.master.entity.SysRegion;
import com.njtoyo.taxi.admin.mapper.master.mapper.SysRegionMapper;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;

import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@Slf4j
@SpringBootTest
@ActiveProfiles(value = "test")
public class 导入行联号 {
    @Autowired
    private SysRegionMapper regionMapper;


    @Test
    public void read() {
        List<SysRegion> regions = regionMapper.selectList(null);
        Map<String, SysRegion> regionToMap = regions.stream().filter(reg -> reg.getLayerLevel() == 2).collect(Collectors.toMap(SysRegion::getName, Function.identity()));
        ExcelReader reader = ExcelUtil.getReader("/Users/saber/Desktop/有滴资料/招商银行/联行号new_20221031083154.xlsx");
        List<List<Object>> readAll = reader.read();
        for (List<Object> list : readAll) {
            System.out.println(list);
        }


    }
}
